home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 726-750 / 729 / bbbbs / spellbbs.lzh / Spell / spellchk.rexx < prev   
OS/2 REXX Batch file  |  1991-04-08  |  1KB  |  56 lines

  1. /*  RxSpell.rexx  - revised 21 Mar 1991 by RLStockton for BaudBandit
  2. RxSpell docs:
  3.  
  4.  As words are sent to RxSpell it will load the dict file as needed, eating
  5.  up lots of memory  :-)
  6.  
  7.  There are only 2 commands:  Quit, and CheckWord (or just Check)
  8.  
  9.  Quit tells RxSpell to quit.
  10.  
  11.  CkeckWord, given a word as an argument, searches for the word and returns 1
  12.  if the word was found, 0 if it wasn't, and 10 if there was an error reading
  13.  the file or there wasn't enough memory.
  14.  
  15. */
  16.  
  17. SIGNAL ON BREAK_C
  18. SIGNAL ON BREAK_E
  19.  
  20. rev   = ""
  21. pen3  = ""
  22. def   = ""
  23. CR    = "0D"x
  24. LF    = "0A"x
  25.  
  26. bbspath=GETCLIP('BBS_path')
  27. RxStart='CD' bbspath'Spell'LF'Run RxSpell Dict.'
  28.  
  29. PARSE ARG name
  30.  
  31. IF ~Open(fh,name,r) then do;Say 'Can''t open file'CR;exit;end
  32. IF ~Show(P,SPELL) then address command RxStart
  33. do i=1 TO  50 while ~Show(P,SPELL);call Delay 10;end
  34. IF ~Show(P,SPELL) then do;Say 'RxSpell problems, exiting'CR;exit;end
  35.  
  36. ADDRESS SPELL
  37.  
  38. DO linenumber=1 WHILE ~EOF(fh)
  39.    new=''
  40.    line=ReadLn(fh)
  41.    line=Translate(line,'     ','9'x'_.-/') /* ARexx doesn't like mixed tabs and spaces */
  42.    DO i=1 TO Words(line)
  43.       wd=Word(line,i)
  44.       Check wd
  45.       IF RC=0 THEN new=new rev||wd||def
  46.       ELSE IF RC=1  THEN new=new wd
  47.       ELSE IF RC=10 THEN Say 'File Error!'CR
  48.       ELSE Say 'Unknown Error 'RC'. word='i' line='line||CR
  49.    END
  50.    SAY pen3||RIGHT(linenumber,3)||def new||CR
  51. END
  52.  
  53. BREAK_E:
  54. BREAK_C:
  55. EXIT;
  56.